-
Notifications
You must be signed in to change notification settings - Fork 108
fix: share with subsites #289
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
imantsk
commented
Nov 4, 2025
- fixed styling and functionality for "Share with subsites" toggle in snippet editor
- fixed Shared snippets to appear in subsite snippets lists with individual activate/deactivate capability
- imporved visual indicators:
- Network admin: Dashicons networking icon with "Shared with subsites" native tooltip
- Subsites: Activation switches for shared snippets (instead of "Network Active" label)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors the handling of shared network snippets in a WordPress multisite environment. The changes improve how shared network snippets are fetched, displayed, and managed across both the REST API and the admin list table interface.
- Standardized the logic for retrieving and marking shared network snippets
- Updated the UI to display a networking icon instead of a text badge for shared snippets
- Enhanced the multisite sharing settings component with improved styling and accessibility
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/php/rest-api/class-snippets-rest-controller.php | Added get_network_items() method to merge shared network snippets into REST API responses |
| src/php/class-list-table.php | Refactored fetch_shared_network_snippets() to return modified array, replaced text badge with icon in activation column |
| src/js/utils/snippets/api.ts | Added shared_network field to API mapping |
| src/js/components/EditorSidebar/controls/MultisiteSharingSettings.tsx | Improved UI with Tooltip component and better label structure |
| src/css/common/_badges.scss | Added styles for .network-shared icon, removed line-height from .badge |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
| * | ||
| * @return array<Snippet> Modified list of snippets. | ||
| */ | ||
| private function get_network_items( array $all_snippets, $network ): array { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can think about the method name. It does not just "get_network_items" :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you have any good suggestion? get_network_snippets maybe?
|
@imantsk It might be worth to try and get Playwright tests running on multisite as well. And then write a test for this case. |
Very good point @louiswol94! However, since this is quite a substantial task, we will address it in a separate issue: #292 |